<?xml version = "1.0" encoding = "utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  
<html xmlns = "http://www.w3.org/1999/xhtml">
  <!-- 2012 lukbrasil -->
  <!-- Internet & World Wide Web How To Program - Exercise 7.12 -->
  <head>
    <title>Exercise 7.12</title>
    
    <script type = "text/javascript">
      <!--
      var menu;
      var accountNumber;
      var balance;
      var charge;
      var credit;
      var limit;
      
      menu = parseInt(window.prompt("Enter an option (1 - customer data, 2 - quit)", "1"));
      while (menu != 2) {
        accountNumber = parseInt(window.prompt("Enter account number", "0"));
        balance = parseInt(window.prompt("Enter beginning balance", "0"));
        charge = parseInt(window.prompt("Enter total charges", "0"));
        credit = parseInt(window.prompt("Enter total credits", "0"));
        limit = parseInt(window.prompt("Enter allowed credit limit", "0"));
        
        balance = balance + charge - credit;
        document.writeln("New balance is " + balance + "<br/>");
        if (balance > limit) {
          document.writeln("<h1>Credit exceeded.</h1>");
        }
        
        menu = parseInt(window.prompt("Enter an option (1 - customer data, 2 - quit)", "1"));
      }
      // -->
    </script>
  </head>
  <body>
  </body>
</html>
